﻿Imports System.Web
Imports System.Web.Services
Imports System.Web.Services.Protocols

<WebService(Namespace:="http://www.resamu.org/")> _
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Public Class annuaire
    Inherits System.Web.Services.WebService

    <WebMethod()> _
    Public Function GetUserBySAMURef(ByVal idresamu As String, ByVal pwd As String) As System.Xml.XmlDocument

        Dim resultat As New System.Xml.XmlDocument

        Dim dbUser As New LogDataSetTableAdapters.user_detailTableAdapter
        Dim data As New LogDataSet.user_detailDataTable

        Dim survey As New surveillance.logsurvey
        survey.Timeout = 60000
        survey.Url = Application("LogAdresse")

        Dim dbAnnuaire As New LogDataSetTableAdapters.user_detailTableAdapter
        Dim dataAnnuaire As New LogDataSet.user_detailDataTable
        Dim message As String

        Try
            data = dbUser.GetDataById(idresamu)
            If data(0).user_pwd = pwd Then
                dataAnnuaire = dbAnnuaire.GetDataBySAMURef(data(0).user_SAMUref)
                dataAnnuaire.WriteXml(Server.MapPath("ANNUAIRE" + idresamu + pwd))
                resultat.Load(Server.MapPath("ANNUAIRE" + idresamu + pwd))
            Else
                resultat.LoadXml("<ERROR>INTRUSION></ERROR>")
                message = "INTRUSION"
            End If
        Catch ex As Exception
            resultat.LoadXml("<ERROR>" + ex.Message + "</ERROR>")
            message = "ERROR/" + ex.Message
        End Try
        Try
            survey.NewLog(idresamu, idresamu, "system", "GetUserBySAMURef", message)
        Catch ex As Exception

        End Try
        Return resultat
    End Function
    <WebMethod()> _
    Public Function GetUserBySAMU(ByVal idresamu As String, ByVal pwd As String, ByVal samu As String) As System.Xml.XmlDocument
        Dim resultat As New System.Xml.XmlDocument

        Dim dbUser As New LogDataSetTableAdapters.user_detailTableAdapter
        Dim data As New LogDataSet.user_detailDataTable

        Dim survey As New surveillance.logsurvey
        survey.Timeout = 60000
        survey.Url = Application("LogAdresse")

        Dim dbAnnuaire As New LogDataSetTableAdapters.user_detailTableAdapter
        Dim dataAnnuaire As New LogDataSet.user_detailDataTable
        Dim message As String

        Try
            data = dbUser.GetDataById(idresamu)
            If data(0).user_pwd = pwd Then
                dataAnnuaire = dbAnnuaire.GetDataBySAMURef(samu)
                dataAnnuaire.WriteXml(Server.MapPath("ANNUAIRE" + idresamu + pwd))
                resultat.Load(Server.MapPath("ANNUAIRE" + idresamu + pwd))
                message = "OPERATION/OK"
            Else
                resultat.LoadXml("<ERROR>INTRUSION></ERROR>")
                message = "INTRUSION"
            End If
        Catch ex As Exception
            resultat.LoadXml("<ERROR>" + ex.Message + "</ERROR>")
            message = "ERROR/" + ex.Message
        End Try
        Try
            survey.NewLog(idresamu, idresamu, "system", "GetUserBySAMURef", message)
        Catch ex As Exception

        End Try
        Return resultat
    End Function
    <WebMethod()> _
    Public Function GetUserByTypeDsSAMURef(ByVal idresamu As String, ByVal pwd As String, ByVal type As String) As System.Xml.XmlDocument
        Dim resultat As New System.Xml.XmlDocument

        Dim dbUser As New LogDataSetTableAdapters.user_detailTableAdapter
        Dim data As New LogDataSet.user_detailDataTable

        Dim survey As New surveillance.logsurvey
        survey.Timeout = 60000
        survey.Url = Application("LogAdresse")

        Dim dbAnnuaire As New LogDataSetTableAdapters.user_detailTableAdapter
        Dim dataAnnuaire As New LogDataSet.user_detailDataTable
        Dim message As String

        Try
            data = dbUser.GetDataById(idresamu)
            If data(0).user_pwd = pwd Then
                dataAnnuaire = dbAnnuaire.GetDataByTypeDsSamuRef(Type, data(0).user_SAMUref)
                dataAnnuaire.WriteXml(Server.MapPath("ANNUAIRE" + idresamu + pwd))
                resultat.Load(Server.MapPath("ANNUAIRE" + idresamu + pwd))
                message = "OPERATION/OK"
            Else
                resultat.LoadXml("<ERROR>INTRUSION></ERROR>")
                message = "INTRUSION"
            End If
        Catch ex As Exception
            resultat.LoadXml("<ERROR>" + ex.Message + "</ERROR>")
            message = "ERROR/" + ex.Message
        End Try
        Try
            survey.NewLog(idresamu, idresamu, "system", "GetUserByTypeDsSAMURef", message)
        Catch ex As Exception

        End Try
        Return resultat
    End Function
    <WebMethod()> _
    Public Function GetUserByTypeDsSAMU(ByVal idresamu As String, ByVal pwd As String, _
    ByVal type As String, ByVal samu As String) As System.Xml.XmlDocument
        Dim resultat As New System.Xml.XmlDocument

        Dim dbUser As New LogDataSetTableAdapters.user_detailTableAdapter
        Dim data As New LogDataSet.user_detailDataTable

        Dim survey As New surveillance.logsurvey
        survey.Timeout = 60000
        survey.Url = Application("LogAdresse")

        Dim dbAnnuaire As New LogDataSetTableAdapters.user_detailTableAdapter
        Dim dataAnnuaire As New LogDataSet.user_detailDataTable
        Dim message As String

        Try
            data = dbUser.GetDataById(idresamu)
            If data(0).user_pwd = pwd Then
                dataAnnuaire = dbAnnuaire.GetDataByTypeDsSamuRef(type, samu)
                dataAnnuaire.WriteXml(Server.MapPath("ANNUAIRE" + idresamu + pwd))
                resultat.Load(Server.MapPath("ANNUAIRE" + idresamu + pwd))
                message = "OPERATION/OK"
            Else
                resultat.LoadXml("<ERROR>INTRUSION></ERROR>")
                message = "INTRUSION"
            End If
        Catch ex As Exception
            resultat.LoadXml("<ERROR>" + ex.Message + "</ERROR>")
            message = "ERROR/" + ex.Message
        End Try
        Try
            survey.NewLog(idresamu, idresamu, "system", "GetUserByTypeDsSAMURef", message)
        Catch ex As Exception

        End Try
        Return resultat
    End Function
    <WebMethod()> _
    Public Function GetUserByCodeP(ByVal idresamu As String, ByVal pwd As String, ByVal codep As String) As System.Xml.XmlDocument
        Dim resultat As New System.Xml.XmlDocument

        Dim dbUser As New LogDataSetTableAdapters.user_detailTableAdapter
        Dim data As New LogDataSet.user_detailDataTable

        Dim survey As New surveillance.logsurvey
        survey.Timeout = 60000
        survey.Url = Application("LogAdresse")

        Dim dbAnnuaire As New LogDataSetTableAdapters.user_detailTableAdapter
        Dim dataAnnuaire As New LogDataSet.user_detailDataTable
        Dim message As String

        Try
            data = dbUser.GetDataById(idresamu)
            If data(0).user_pwd = pwd Then
                dataAnnuaire = dbAnnuaire.GetDataByCodeP(codep)
                dataAnnuaire.WriteXml(Server.MapPath("ANNUAIRE" + idresamu + pwd))
                resultat.Load(Server.MapPath("ANNUAIRE" + idresamu + pwd))
                message = "OPERATION/OK"
            Else
                resultat.LoadXml("<ERROR>INTRUSION></ERROR>")
                message = "INTRUSION"
            End If
        Catch ex As Exception
            resultat.LoadXml("<ERROR>" + ex.Message + "</ERROR>")
            message = "ERROR/" + ex.Message
        End Try
        Try
            survey.NewLog(idresamu, idresamu, "system", "GetUserByTypeDsSAMURef", message)
        Catch ex As Exception

        End Try
        Return resultat
    End Function
    <WebMethod()> _
    Public Function GetUserByTypeEtCodeP(ByVal idresamu As String, ByVal pwd As String, _
    ByVal type As String, ByVal codep As String) As System.Xml.XmlDocument
        Dim resultat As New System.Xml.XmlDocument

        Dim dbUser As New LogDataSetTableAdapters.user_detailTableAdapter
        Dim data As New LogDataSet.user_detailDataTable

        Dim survey As New surveillance.logsurvey
        survey.Timeout = 60000
        survey.Url = Application("LogAdresse")

        Dim dbAnnuaire As New LogDataSetTableAdapters.user_detailTableAdapter
        Dim dataAnnuaire As New LogDataSet.user_detailDataTable
        Dim message As String

        Try
            data = dbUser.GetDataById(idresamu)
            If data(0).user_pwd = pwd Then
                dataAnnuaire = dbAnnuaire.GetDataByCodePEtType(codep, type)
                dataAnnuaire.WriteXml(Server.MapPath("ANNUAIRE" + idresamu + pwd))
                resultat.Load(Server.MapPath("ANNUAIRE" + idresamu + pwd))
                message = "OPERATION/OK"
            Else
                resultat.LoadXml("<ERROR>INTRUSION></ERROR>")
                message = "INTRUSION"
            End If
        Catch ex As Exception
            resultat.LoadXml("<ERROR>" + ex.Message + "</ERROR>")
            message = "ERROR/" + ex.Message
        End Try
        Try
            survey.NewLog(idresamu, idresamu, "system", "GetUserByTypeDsSAMURef", message)
        Catch ex As Exception

        End Try
        Return resultat
    End Function

End Class
